
let arr:string[] = ['a','b','c'];

//一件商品

interface Product{
    name:string,
    price:number,
    desc:string
}

let product:Product = {name:'空调',price:80,desc:"冬暖夏凉"};

console.log(product);

//商品列表  数组

let list:Product[] = [];

list.push({name:'空调',price:8000,desc:"冬暖夏凉"});

list.push({name:'电扇',price:90,desc:'风'});

console.log(list);

//类型推断
let num11 = 10;

//类型断言

let someValue:any = 'it is any type';

//1.尖角号的形式

let someLength1:number = (<string>someValue).length;

console.log(someLength1);

//2.as形式  常用

let someLength2:number = (someValue as string).length;

console.log(someLength2);

//接口继承  extends

//形状

interface Shape{
    color:string
}

interface PenWidth{
    width:number
}

interface Square extends Shape,PenWidth{
    height:number
}

let square1:Square = {color:'red',width:80,height:80};

console.log(square1)



